﻿<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
    <head>
        <title>意见类型更新 - 后台管理 - smoothly</title>
        <!-- 引入网站头部 -->
        <div th:replace="~{include/all_include::title}"/>
    </head>
    <body>
        <!-- body的标题栏 -->
        <nav class="breadcrumb">
            <i class="Hui-iconfont">&#xe67f;</i> 首页
            <span class="c-gray en">&gt;</span> 意见管理
            <span class="c-gray en">&gt;</span> 意见类型更新
            <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px"
               href="javascript:location.replace(location.href);" title="刷新">
                <i class="Hui-iconfont">&#xe68f;</i>
            </a>
        </nav>
        <!-- 内容 -->
        <article class="page-container">
            <form class="form form-horizontal" th:action="@{/back/opinion/opinionTypeUpdateSubmit}" method="post" id="formId">
                <input type="hidden" name="id" th:value="${response?.data?.one?.id}"/>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>名称：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="text" class="input-text" th:value="${response?.data?.one?.name}" placeholder="请输入名称" id="name" name="name">
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">发布时间：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"
                               readonly
                               th:value="${response?.data?.one?.pubTime}"
                               id="pubTimeStr" name="pubTimeStr" class="input-text Wdate">
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>状态：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <span class="select-box">
                            <select name="status" class="select">
                                <option value="1" th:selected="${response?.data?.one?.status == '1'}">启用</option>
                                <option value="0" th:selected="${response?.data?.one?.status == '0'}">禁用</option>
                            </select>
				        </span>
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">内容：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <script id="editor" type="text/plain" name="content" style="width:100%;height:400px;"></script>
                    </div>
                </div>
                <div class="row cl">
                    <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
                        <button onClick="article_save_submit();" class="btn btn-primary radius" type="submit">
                            <i class="Hui-iconfont">&#xe632;</i> 提交
                        </button>
                    </div>
                </div>
            </form>
        </article>

        <!-- 引入公共的头部 -->
        <div th:replace="~{include/all_include::footer}"></div>

        <script type="text/javascript" th:inline="javascript">
            var rootPath = [[@{/}]];
            $(function () {
                $('.skin-minimal input').iCheck({
                    checkboxClass: 'icheckbox-blue',
                    radioClass: 'iradio-blue',
                    increaseArea: '20%'
                });

                //表单验证
                $("#formId").validate({
                    rules: {
                        name: {
                            required: true,
                        },
                        content: {
                            required: true,
                        }
                    },
                    onkeyup: false,
                    focusCleanup: true,
                    success: "valid",
                    submitHandler: function (form) {
                        $(form).ajaxSubmit({
                            type: 'post',
                            success: function (data) {
                                /* 弹出框 */
                                layer.msg(data.info, {icon: 1, time: 3000}, function () {
                                    if (data.code == '0') {
                                        /* 刷新父窗口 */
                                        window.parent.location.reload();
                                        var index = parent.layer.getFrameIndex(window.name);
                                        parent.layer.close(index);
                                    }
                                });
                            },
                            dataType: "json"
                        });
                    }
                });

                /* 为编辑器赋值 */
                var ue = UE.getEditor('editor');
                var content = [[${response?.data?.one?.content}]];
                ue.addListener("ready", function () {
                    ue.setContent(content);
                });
            });
        </script>
    </body>
</html>